<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" isELIgnored="false" import="java.util.*"
	pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ include file="/include/header.jsp"%>
<html>

<head>
<title><s:i18n name="menus"><s:text name="official"></s:text></s:i18n></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
</head>

<script type="text/javascript"
	src="<%=request.getContextPath() %>/fare/js/datePicker/WdatePicker.js"></script>
<%-- <script type="text/javascript" src="${pageContext.request.contextPath}/fare/js/show.js"></script>--%>
<link
	href='<%=request.getContextPath()%>/fare/js/cityquery/cityquery.css'
	rel="stylesheet" type="text/css" />

<link href="<%=request.getContextPath() %>/fare/css/base.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript"
	src="<%=request.getContextPath() %>/FusionCharts/FusionCharts.js"></script>
</head>
<%-- <script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/citylist.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/querycity.js'></script> --%>
<link rev="stylesheet" media="all"
	href="<%=request.getContextPath() %>/fare/css/form_style.css"
	type="text/css" rel="stylesheet">
	<!-- 圆角文本框 -->
	<link href="<%=request.getContextPath() %>/fare/css/htc/htc.css"
		rel="stylesheet" type="text/css" />
	<script type="text/javascript"
		src="<%=request.getContextPath() %>/jsFile/wait/js/wait.js"></script>
<%-- 	<script src="<%=request.getContextPath() %>/fare/js/loadPlaneNo.js"
		type="text/javascript"></script> --%>
	<script type="text/javascript">
	var queryType = 'lineAndFlight';
	$(function(){
		//alert("${sessionScope.currentUser}");
		disableCabinSelect();
		$('#depCity').querycity({'data':citysFlight,'tabs':labelFromcity,changeDoFusion: changeEvent});
		$('#arrCity').querycity({'data':citysFlight,'tabs':labelFromcity,changeDoFusion: changeEvent});
		//$('#depCity').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList,'changeDoFusion':function(){loadFlightNo();}});
		//$('#arrCity').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList,'changeDoFusion':function(){loadFlightNo();}});
		$("#depCity").css({color:'black'});
		$("#arrCity").css({color:'black'});
		$('#flightStartDate').val(generateTimeByFutrueDay(0));
		$('#flightEndDate').val(generateTimeByFutrueDay(29));
		$("#futureDay").click(function(){//未来天数被点击
			$('#flightStartDate').val("");
			$('#flightEndDate').val("");
			$("input[name='flightDateRadio'][type='radio'][value='2']").attr('checked',true);
		});
		$("#flightStartDate").click(function(){//出发/到达城市被点击
			$("input[name='flightDateRadio'][type='radio'][value='1']").attr('checked',true);
			$("#futureDay").val("");
			if($(this).val()=="" && $("#flightEndDate").val()=="" ){
				$('#flightStartDate').val(generateTimeByFutrueDay(0));
				$('#flightEndDate').val(generateTimeByFutrueDay(29));
			}
		});
		$("#flightEndDate").click(function(){//出发/到达城市被点击
			$("input[name='flightDateRadio'][type='radio'][value='1']").attr('checked',true);
			$("#futureDay").val("");
			if($(this).val()=="" && $("#flightStartDate").val()==""){
				$('#flightStartDate').val(generateTimeByFutrueDay(0));
				$('#flightEndDate').val(generateTimeByFutrueDay(29));
			}
		});
		
		
		$("input[name='flightDateRadio'][type='radio']").change(function(){
			if($(this).val()==1){
				$("#futureDay").val("");
				$('#flightStartDate').val(generateTimeByFutrueDay(0));
				$('#flightEndDate').val(generateTimeByFutrueDay(29));
			}else{
				$('#flightStartDate').val("");
				$('#flightEndDate').val("");
			}
		});
		
		$("input[name='periodsRadio'][type='radio']").change(function(){
			if($(this).val()==1){
				$("input[name='periods'][type='checkbox']").each(function(){
					$(this).attr('checked',true);
				});
				$("#selfStartPeriods").val("");
				$("#selfEndPeriods").val("");
			}else{
				$("input[name='periods'][type='checkbox']").each(function(){
					$(this).attr('checked',false);
				});
			}
		});
		$("input[name='periods'][type='checkbox']").each(function(){
			$(this).click(function(){
				$("input[name='periodsRadio'][type='radio'][value='1']").attr("checked",true);
				$("#selfStartPeriods").val("");
				$("#selfEndPeriods").val("");
			});
		});
		
		$("#selfStartPeriods").click(function(){
			$("input[name='periodsRadio'][type='radio'][value='2']").attr("checked",true);
			$("input[name='periods'][type='checkbox']").each(function(){
					$(this).attr('checked',false);
				});
		});
		$("#selfEndPeriods").click(function(){
			$("input[name='periodsRadio'][type='radio'][value='2']").attr("checked",true);
			$("input[name='periods'][type='checkbox']").each(function(){
					$(this).attr('checked',false);
				});
		});
		
	});
	function changeEvent(){
		 var tocity = $("#depCity").val();
		 var fromcity = $("#arrCity").val();
		 /* var fromCityCode = $("#depCityCode").val();
		 var toCityCode = $("#arrCityCode").val(); */
		 if((fromcity =='' && tocity !='')||(tocity=='<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>'&& fromcity=='<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>')){
			 alert("<s:i18n name='forms'><s:text name='forms.chooseRoutes'></s:text></s:i18n>");
			 $("#fromCity").focus();
			 return false;
		 }else if(fromcity == tocity){
			 alert("<s:i18n name='forms'><s:text name='forms.sameCity'></s:text></s:i18n>");
			 $("#fromCity").focus();
			 return false;
		 }else if((fromcity !='' && tocity== '')||fromcity !='' && tocity== '<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>'){
			 return false;
		 }else{
			resetRows();
			 
		 }
	}
	
	var i=1;
	function loadFlightNo(carrierName){
		queryType = 'lineAndFlight';
		var depCity=$("#depCity").val();
		var arrCity=$("#arrCity").val();
		var depCityCode=$("#depCityCode").val();
		var arrCityCode=$("#arrCityCode").val();
		var carrier = null;
		if(carrierName){
			carrier=$("#"+carrierName).val().split("_")[0];
		}else{
			carrier=$("#airLineCompany").val();
		}
		if(checkForm()&&depCity!="<s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n>"&&arrCity!="<s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n>"){
			var bool= isreflush(i,depCity,arrCity,carrier);
			if(bool){
		    		$.ajax({
		                  url : 'commonAction!outCityFlightNo.action',
		                  data : {'fromCity':depCity,'toCity':arrCity,'fromCityCode':depCityCode,'toCityCode':arrCityCode,'carrier':carrier},
		                  type : "POST",
		                  dateType:'json',
		                  beforeSend : function(XMLHttpRequest) {// 提交之前的处理代码放在此处,可空着
		                	  FDCWait.show();           
		                  },
		                  success : function(data) {
		                	  $("#flightTime").html('');
		                	  document.getElementById("flightNo").innerHTML="";
		                	if(data==""||data==null){ 
		                		  //document.getElementById("flightNo").innerHTML="<option value=''>--选 择--</option>";
		                		  
		                		  var opt=document.createElement("OPTION");
		                		  opt.text = '--<s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n>--';
		                		  opt.value = '';
		                		  document.getElementById("flightNo").options.add(opt);
		                	 	  return ;
		                	  }
		                	/*  document.getElementById("flightNo").innerHTML="<option value=''ertyeryet>tyertyer--选 择--</option>"; */
		                	 var opt=document.createElement("OPTION");
		                		  opt.text = '--<s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n>--';
		                		  opt.value = '';
		                		  document.getElementById("flightNo").options.add(opt);
		                	  var unitys_str=data.split("#");
		                	 // alert($('#flightNo').html());
		                	  for(var i=0;i<unitys_str.length;i++){
		                		  var s_unity=unitys_str[i];
		                		  if(s_unity!="" || s_unity!=null){
		                			  var stext=s_unity.split("=");
		                				 if('channelId'==stext[0]||stext[0]==''){
			                				  continue;
			                			  }
		                			  var opt=document.createElement("OPTION");
		                			  document.getElementById("flightNo").options.add(opt);
		                			    opt.text=stext[1];
		                			    opt.value=stext[1];
		                			    opt.grade=stext[0];
		                			    
		                		   }
		                	  }
		                	 /// document.getElementById("flightNo").options[0].selected=true;
		                  },
		                  error : function(data) {
		                        alert('<s:i18n name="forms"><s:text name="forms.prompt"></s:text></s:i18n>', 
		                        		'<s:i18n name="forms"><s:text name="forms.timeout"></s:text></s:i18n>');
		                  },
		      		    complete:function(){ 
		    		    	FDCWait.hide();
		    		    }
		            });
			}
		}
		i++;
	}

	
	
	function checkForm(){
		 if($("#arrCityCode").val()==null || $("#arrCityCode").val()=='<s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n>'){
			 alert("<s:i18n name='forms'><s:text name='forms.notFromCity'></s:text></s:i18n>");
			 return false;
		 }
		 if($("#depCityCode").val() ==null || $("#depCityCode").val() == '<s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n>'){
			 alert("<s:i18n name='forms'><s:text name='forms.notToCity'></s:text></s:i18n>");
			 return false;
			 
		 }
		 if($("#arrCityCode").val()==$("#depCityCode").val()){
			 alert("<s:i18n name="forms"><s:text name="forms.sameCity"></s:text></s:i18n>");
			 return false;
		 }
		 
		 return true;
	 }

	/*
	 * 比较上一次选择的值
	 **/
	 var v1,v2,v3;
	 var isreflush=function compareSelectValue(i,o1,o2,o3){
				   if(v1!=o1||v2!=o2||v3!=o3){
				    			 v1=o1;
		 				    	 v2=o2;
		 				    	 v3=o3;
				    			return true;
				    		}
				    			 v1=o1;
	 				    	 v2=o2;
	 				    	 v3=o3;
				    	return false;
				    }

	//查询的验证
	function queryValidate(){
		
		if(validateFlightCity()==true && validateFlightDate()==true){
			if(flightNoSeleteChange()==true){//用户选择了航班号，则忽略用户的自定义时间段
				ajaxLoad();
			}else if(validatePeriods()==true){
				ajaxLoad();
			}
		}
	}
	
	//验证航班
	function validateFlightCity(){
		var depCity =$('#depCity').val();
	    var arrCity =$('#arrCity').val();
	    if(depCity==''||depCity=='<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>' || arrCity==''||arrCity=='<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>'){
			    alert("<s:i18n name='forms'><s:text name='forms.chooseRoutes'></s:text></s:i18n>");
		        return false;	     
		}
	    if(depCity == arrCity){
	    	alert("<s:i18n name='forms'><s:text name='forms.sameCity'></s:text></s:i18n>");
	    	return false;
	    }
	    return true;
	}
	//验证航班日期
	function validateFlightDate(){
		var value=$("input[name='flightDateRadio'][type='radio']:checked").val();
		if(value=='1'){
			var startdate = $('#flightStartDate').val();
			var enddate = $('#flightEndDate').val();
			
			if(startdate=="" || enddate==""){
				alert("<s:i18n name='forms'><s:text name='forms.notFlightDate'></s:text></s:i18n>");
				return false;
			}	
			var s_date = new Date(startdate.replace(/-/g,"/"));
		    var e_date = new Date(enddate.replace(/-/g,"/"));
		    var time1 = s_date.getTime();
			var time2 = e_date.getTime();
			if(time1>time2){
				alert("<s:i18n name='forms'><s:text name='forms.startBeforeEnd'></s:text></s:i18n>");
				return false;
			}
		}else if(value=='2'){//未来天数
			var futureDays =$('#futureDay').val();
			if(futureDays==""){
				alert("您选择的是按【未来天数】查询，请输入未来天数");
				return false;
			}
			if(futureDays > 30){
				alert("请输入不多于未来30天(包含本日)的天数");
				return false;
			}
		}else{
			return false;
		}
		return true;
	}
	
	
	
	//验证时间段
	function validatePeriods(){
		var value=$("input[name='periodsRadio'][type='radio']:checked").val();
		if(value==1){//选择定义好的时间
			var isCheck=false;
			 $("input[name='periods']").each(function() {
				if($(this).attr("checked")=='checked' || $(this).attr("checked")==true || $(this).attr("checked")=='true'){
					isCheck=true;
				}
			 });
			 if(!isCheck){
				 alert("<s:i18n name='forms'><s:text name='forms.chooseOne'></s:text></s:i18n>");
					return false;
			 }
			
		}else{
			var start=$("#selfStartPeriods").val();
			var end=$("#selfEndPeriods").val();
			var reg=/^[0-9]|[1-9][0-9]$/;
			if(reg.test(start)==false || reg.test(end)==false){
				alert("请填写正确的时间段");
				return false;
			}
			if(parseInt(start)<0 || parseInt(end)<parseInt(start) ){
				alert("<s:i18n name='forms'><s:text name='forms.startBeforeEnd'></s:text></s:i18n>");
				return false;
			}
			if(parseInt(end)>24){
				alert("不能超过24小时");
				return false;
			}
			
		}
		return true;
	}
	
	
	//选择航班号变化的时候触发
	//有选择返回true,没有选择返回false
	function flightNoSeleteChange(){
		var val=$("#flightNo").val();
		if(val=="" || val==undefined){
			$("#timePersiod_tr").show(500);
			return false;
		}else{
			$("#timePersiod_tr").hide(500);
			return true;
		}
	}
	
	//验证航班
	function validateFlightCity(){
		var depCity =$('#depCityCode').val();
	    var arrCity =$('#arrCityCode').val();
	    if(depCity==''||depCity=='<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>' || arrCity==''||arrCity=='<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>'){
			    alert("<s:i18n name='forms'><s:text name='forms.chooseRoutes'></s:text></s:i18n>");
		        return false;	     
		}
	    if(depCity == arrCity){
	    	alert("<s:i18n name='forms'><s:text name='forms.sameCity'></s:text></s:i18n>");
	    	return false;
	    }
	    return true;
	}
	
	function ajaxLoad(){
		var url ;
		if(queryType == 'cabin'){
			url ="<%=request.getContextPath() %>"+"/channelContrastAction!analyseCabin.action";
		}else if(queryType == 'lineAndFlight'){
			url ="<%=request.getContextPath() %>"+"/channelContrastAction!analyse.action";
		}
		//序列化的时候需要可用，不然会少了这个属性
		$("#airCompanyHbaseKey").attr("disabled",false);
	    var data=$("#queryForm").serialize();
	    $("#airCompanyHbaseKey").attr("disabled",true);
		$.ajax({
			url:url,
			data:data,
			type : "POST",
			cache : false, 
			async : true,
		    dataType:'json',
		    beforeSend:function(){
		    	FDCWait.show();
		    },
		    success:function(data){
		    	var chart = new FusionCharts("<%=request.getContextPath() %>/FusionCharts/MSLine.swf", "chartID", 990, "450");
				chart.setDataXML(data.Xml.xmlString);
				chart.render("chartDiv");
				createForm(data.Rows);
		    },
		    error:function(){ alert("<s:i18n name='forms'><s:text name='forms.contactAdministrator'></s:text></s:i18n>");},
		    complete:function(){ 
		    	FDCWait.hide();
		    }
		});
	}
	function createForm(rows){
		//$("#spreadContainer");
		
		//获得标头有多少个航空公司和渠道
		var companyNum = rows[0].contrastList.length+1;
		var nativeCarrier = rows[0].nativeCarrier;
		//有多少天,即表格有多少行
		var totalRowNum = rows.length;
	    var tableStr = '<table width="0" border="0" cellspacing="0" cellpadding="0"	class="form_list" >'
	    	+'<tr class="title">'
		    +'<td style="text-align: center;width: 55px;"><s:i18n name="forms"><s:text name="forms.flightDate"></s:text></s:i18n></td>'
		    +'<td style="text-align: center;width: 55px;">'+nativeCarrier+'</td>';
		
		for(var i=0; i<rows[0].contrastList.length;i++){
			tableStr  +='<td style="text-align: center;width: 55px;">'+rows[0].contrastList[i].carrierName+'</td>';
			tableStr +='<td style="text-align: center;width: 55px;"><s:i18n name="forms"><s:text name="forms.spread"></s:text></s:i18n></td>';
			tableStr +='<td style="text-align: center;width: 55px;"><s:i18n name="forms"><s:text name="forms.spreadAment"></s:text></s:i18n></td>';
		}	
		tableStr += '</tr>';
		//组织数据显示
		tableStr += '<tbody id="table2" >';
		var dataStr = '';
		for(var i=0;i<rows.length;i++){
			dataStr += '<tr>';
			dataStr += '<td class="line" style="text-align: center">' +rows[i].date + '</td>';
			if(rows[i].nativePrice != null && rows[i].nativePrice!='0.0'){
				dataStr += '<td class="line" style="text-align: center">' +rows[i].nativePrice + '</td>';
				for(var j=0;j<rows[i].contrastList.length;j++){
					if(rows[i].contrastList[j].price != null && rows[i].contrastList[j].price != '0.0'){
						dataStr += '<td class="line" style="text-align: center">' +rows[i].contrastList[j].price + '</td>';
						dataStr += '<td class="line" style="text-align: center">' +rows[i].contrastList[j].spreadAmount + '</td>';
						dataStr += '<td class="line" style="text-align: center">' +rows[i].contrastList[j].spread + '</td>';
					}else{
						dataStr += '<td class="line" style="text-align: center">-</td>';
						dataStr += '<td class="line" style="text-align: center">-</td>';
						dataStr += '<td class="line" style="text-align: center">-</td>';
					}
					
				}
			}else{
				dataStr += '<td class="line" style="text-align: center">-</td>';
				for(var j=0;j<rows[i].contrastList.length;j++){
					if(rows[i].contrastList[j].price != null && rows[i].contrastList[j].price != '0.0'){
						dataStr += '<td class="line" style="text-align: center">' +rows[i].contrastList[j].price + '</td>';
					}else{
						dataStr += '<td class="line" style="text-align: center">-</td>';
					}
					
					dataStr += '<td class="line" style="text-align: center">-</td>';
					dataStr += '<td class="line" style="text-align: center">-</td>';
				}
			}
			
		}
		tableStr += dataStr;
		tableStr += '</tbody>';
		tableStr += '</table>';	
		$("#spreadContainer").html(tableStr);
		
	}
	
	
	//重置form
	function resetForm(){
		$('#flightStartDate').val(generateTimeByFutrueDay(0));
		$('#flightEndDate').val(generateTimeByFutrueDay(30));
		$("#depCity").val("<s:i18n name='forms'><s:text name='forms.cnOrPingYing'></s:text></s:i18n>");
		$("#arrCity").val("<s:i18n name='forms'><s:text name='forms.cnOrPingYing'></s:text></s:i18n>");
		$("#depCityCode").val("");
		$("#arrCityCode").val("");
		$("input[name='flightDateRadio'][type='radio'][value='1']").attr('checked',true);
		$("input[name='periodsRadio'][type='radio'][value='1']").attr('checked',true);
		$("#futureDay").val("");
		$("input[name='periods'][type='checkbox']").each(function(){
			$(this).attr("checked",true);
		});
		$("#selfStartPeriods").val("");
		$("#selfEndPeriods").val("");
		//$("#dataSourceHbaseKey")[0].selectedIndex=0;
		$("input[name='comparedCompanyHbaseKeys'][type='checkbox']").each(function(){
			$(this).attr("checked",true);
		});
		$("#flightNo").empty();
    	$("#flightNo").append("<option value=''>--<s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n>--</option>");
    	$("input[name='priceType']:first").attr('checked',true);
    	$("#cabins").empty();
    	$("#cabins").append("<option>--<s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n>--</option>");
    	//flightNoSeleteChange();
	}
	
	/**
	 * 生成一个未来天数的日期字符串
	 */
	function generateTimeByFutrueDay(day){
		if(!/^\d+$/.test(day)){day=0;}
		var now=new Date();
		now.setDate(now.getDate()+day);
		var year=now.getFullYear();
		var month=now.getMonth()+1;
		month=month<10?"0"+month:month+"";
		var date=now.getDate();
		date=date<10?"0"+date:date+"";
		return year+"-"+month+"-"+date;
	}
	var j=1;
	function changeCabin(object){
		queryType = 'cabin';
		
		if($("#cabins").val() == ""){
			queryType = 'lineAndFlight';
			disableCabinSelect();	
		}else{
			enableCabinSelect();
		}
		
		
		var carrierKey = $("#airCompanyHbaseKey").val().split("_")[1];;
		var hbaseKey ;
		var type;
		
		
		//官网的舱位点击时
		if(object == 'airCompanyHbaseKey'){
			
		    hbaseKey = $("#airCompanyHbaseKey").val().split("_")[0];
		    type = true;
		}else{
			hbaseKey = $(object).attr("id").split("_")[1];
			type = false;
		}
		var fromCityCode=$("#depCityCode").val();
		var toCityCode=$("#arrCityCode").val();
		var flightNo = $("#flightNo").val();
		if(!validateFlightCity() || flightNo == ''){
			return ;
		}
		
		var isNewClick = isNew(carrierKey,hbaseKey,fromCityCode,toCityCode,flightNo);
		if(isNewClick){
			$.ajax({
				url:"<%=request.getContextPath()%>/airCompanyTrendLineFlightCabinAction!getCabinsByConditions.action",
				data:{
					dataSourceHbaseKey:hbaseKey,
					fromCityCode:fromCityCode,
					toCityCode:toCityCode,
					flightNo:flightNo,
					carrierKey:carrierKey
				},
				type:'post',
				dataType:'json',
				cache : false, 
			    async : false,
			    beforeSend:function(){FDCWait.show();},
			    success:function(data){
			    	
			    	if(data.Total>0){
			    		displayCabins(data.Total,data.Rows,hbaseKey,type);
			    	}
			    },
			    error:function(){},
			    complete:function(){FDCWait.hide();}
			});
		}
		j++;
	
	}
	 var v1,v2,v3,v4,v5;
	 var isNew=function compareSelectValue1(o1,o2,o3,o4,o5){
				   if(v1!=o1||v2!=o2||v3!=o3||v4!=o4||v5!=o5){
				    			 v1=o1;
		 				    	 v2=o2;
		 				    	 v3=o3;
		 				    	 v4=o4;
		 				    	 v5=o5;
				    			return true;
				    		}
				    			 v1=o1;
	 				    	 v2=o2;
	 				    	 v3=o3;
	 				    	 v4=o4;
	 				    	 v5=o5;
				    	return false;
  	 } 
	function enableCabinSelect(){
		 $(".channelCabinsClass").show();
	 }
	function disableCabinSelect(){
		$(".channelCabinsClass").hide();
	}
	function displayCabins(count,rows,hbaseKey,type){
		if(type ==  false){
			//清除之前的舱位
			$("#cabin_"+hbaseKey+" option").remove();//cabin_${item.hbaseKey}
			$("#cabin_"+hbaseKey).append("<option value=''>"+"--<s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n>--"+"</option>");
			for(var i=0;i<count;i++){
					$("#cabin_"+hbaseKey).append("<option value='"+rows[i].carrierFlightnoCabin+"'>"+rows[i].cabinType+"</option>");
			}
		}else{
			//清除之前的舱位
			$("#cabins option").remove();//cabin_${item.hbaseKey}
			$("#cabins").append("<option value=''>"+"--<s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n>--"+"</option>");
			for(var i=0;i<count;i++){
					$("#cabins").append("<option value='"+rows[i].carrierFlightnoCabin+"'>"+rows[i].cabinType+"</option>");
			}
		}
		
	}
	
</script>

	<body>
		<%-- 麻烦大家写页面的时候便签的距离还有格式尽量对其，过一行进一格，养成良好习惯 --%>
		<%@ include file="/include/home/home_header.jsp" %>
		<jsp:include page="/pages/system/feedback/feedback.jsp"></jsp:include>
		<div class="main main_max" style="height: 100%">
			<div class="sideBar">
				<div class="box">
					<div class="location"><s:i18n name="forms"><s:text name="forms.position"></s:text></s:i18n>： <s:i18n name="menus"><s:text name="realtime"></s:text></s:i18n> &gt;  
		<s:i18n name="menus"><s:text name="official"></s:text></s:i18n></div>
				</div>
			</div>
			<div class="cls"></div>
			<div class="content">
				<div class="form_table_tltle"><s:i18n name="forms"><s:text name="official"></s:text></s:i18n></div>
				<form id="queryForm" method="post">
					<table cellSpacing=0 cellPadding=0 width="100%" border=0
						class="form_table">
						<tr class="tab">
							<td width="120" align="right" class="left"><s:i18n name="menus"><s:text name="forms.airlines"></s:text></s:i18n>:</td>
							<td style="width: 400px;"><select onchange="" style="width: 150px;"
										name="airCompanyHbaseKey"
								id="airCompanyHbaseKey" disabled="disabled">
									<c:forEach var="item" items="${crawlCompanys}">
										<option value="${item.hbaseKey}_${item.carrierKey}_${item.shortName}"
											<c:if test="${item.id==sessionScope.currentUser.sourceId}">selected='selected' </c:if>>${item.name}</option>
									</c:forEach>
							</select><font color="red">*</font> <span id="flightTime"> <input
									id="Times" type="hidden" value="" /></span></td>
							<td></td>
							<td></td>
						</tr>

						<tr class="tab">
							<td width="120" align="right" class="left"><s:i18n name="forms"><s:text name="forms.trip"></s:text></s:i18n>:</td>
							<td>
						   <c:if test="${language=='en_US'}">
		   					 <jsp:include page="../../inc/flightSelect_en_Us.jsp"></jsp:include>
		   					</c:if>
						    <c:if test="${language=='zh_CN' or language=='other'}">
						   			 <jsp:include page="../../inc/flightSelect.jsp"></jsp:include>
						    </c:if>
												<!-- <input type="text" name="depCity" style="width:100px" id="depCity" readonly='readonly'/>
	   					<span>到</span>
	   					<input type="text" name="arrCity" style="width:100px" id="arrCity" readonly='readonly'/>
	   					<span style="color: #ff0000">*</span> --></td>
							<td colspan="1" style="width: 110px;"></td>
							<td colspan="1" style="width: 110px;"></td>
						</tr>
						<tr>
							<td width="120" align="right" class="left"><s:i18n name="forms"><s:text name="forms.flight"></s:text></s:i18n>:</td>
							<td>
								<!-- <select id='flightNo' name='flightNo'
									onclick="loadFlightNo('airCompanyHbaseKey');">
										<option value=''>-- 请选择 --</option>
								</select> -->
								<select id='flightNo' name='flightNo'
									onclick="loadFlightNo('airCompanyHbaseKey');">
										<option value=''>-- <s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n>--</option>
								</select>
							</td>
							<td class="left"><s:i18n name="forms"><s:text name="forms.classLevel"></s:text></s:i18n>:</td>
							<td colspan="2"><select id="cabins"
								name="airCompanyCabin" style="width: 90px;"
								onclick="changeCabin('airCompanyHbaseKey');">
									<option value="">-- <s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n>--</option>
							</select></td>


						</tr>
						<TR>
							<TD colspan="1" width="120" height="26" class="left"
								style="text-align: left"><s:i18n name="forms"><s:text name="forms.priceType"></s:text></s:i18n>：</TD>
							<TD colspan="1"><input name="priceType" value="lowest"
								type="radio" checked="checked"> <s:i18n name="forms"><s:text name="forms.lowestPrice"></s:text></s:i18n>
									&nbsp;&nbsp;&nbsp;&nbsp; <input name="priceType" type="radio"
									value="highest"> <s:i18n name="forms"><s:text name="forms.highestPrice"></s:text></s:i18n> </TD>
							<td class="left" style="text-align: left"></td>
							<td></td>
						</TR>
						<tr>
							<td height="26" class="left" style="text-align: left">
							  <div style="display:none;"><input name="flightDateRadio" value="1" type="radio" checked="checked">
							  </input>
							  </div>
							  <s:i18n name="forms"><s:text name="forms.flightDate"></s:text></s:i18n>：
							</td>
							<td><input name="flightStartDate" type="text"
								id="flightStartDate" style="width: 100px"
								onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate: '%y-%M-%d',maxDate:'${maxDate}',lang:'<s:i18n name='forms'><s:text name='forms.locale'></s:text></s:i18n>'});">
									<span>~</span> <input name="flightEndDate" type="text"
									id="flightEndDate" style="width: 100px"
									onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate: '%y-%M-%d',maxDate:'${maxDate}',lang:'<s:i18n name='forms'><s:text name='forms.locale'></s:text></s:i18n>'});">
										<span style="color: #ff0000">*</span></td>
							<td class="left" style="text-align: left">
								<!--  <input name="flightDateRadio"   type="radio" value="2">未来天数： -->
							</td>
							<td>
								<!-- <input type="text" style="width:30px" maxlength="2" 
				 	    name="futureDay" id="futureDay"  onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">天 -->
							</td>
						</tr>
						<tr id='timePersiod_tr'>
							<td class="left" style="text-align: left">
							 <div style="display:none;"><input name="periodsRadio" value="1" type="radio" checked="checked">
							 </input>
							 </div>
							 <s:i18n name="forms"><s:text name="forms.departureTime"></s:text></s:i18n>：
							</td>
							<td colspan="3"><input type="checkbox" name="periods"
								value="M" checked="checked" /><s:i18n name="forms"><s:text name="forms.morning"></s:text></s:i18n> <input type="checkbox"
								name="periods" value="B" checked="checked" /><s:i18n name="forms"><s:text name="forms.noon"></s:text></s:i18n> <input
								type="checkbox" name="periods" value="A" checked="checked" /><s:i18n name="forms"><s:text name="forms.afternoon"></s:text></s:i18n>
								<input type="checkbox" name="periods" value="N"
								checked="checked" /><s:i18n name="forms"><s:text name="forms.night"></s:text></s:i18n></td>
						</tr>							
						<%-- <c:forEach var="item" items="${crawlChannels}">
							<tr class="tab">
								<td align="right" class="left">比较渠道：</td>
								<td>
									<input type="checkbox" id="checkbox_${item.hbaseKey}" name="comparedChannelHbaseKey" value="${item.hbaseKey}_${item.carrierKey}_${item.shortName}"> ${item.name}
								</td>
								<td colspan="2">
									<select class="channelCabinsClass"  id="cabin_${item.hbaseKey}" name="comparedCabins"  style=" width: 90px;" onclick="changeCabin(this);">
										<option value="">-- 请选择 --</option>
									</select>
								</td>
							</tr>
						</c:forEach> --%>
						
							<tr class="tab">
								<td align="right" class="left"><s:i18n name="forms"><s:text name="forms.compareChannel"></s:text></s:i18n>：</td>
								
								<td colspan="2">
								<c:forEach var="item" items="${crawlChannels}">
									<input type="checkbox" id="checkbox_${item.hbaseKey}" name="comparedChannelHbaseKey" value="${item.hbaseKey}_${item.carrierKey}_${item.shortName}"> ${item.name}
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								</c:forEach>
								</td>
								<td></td>
								<%-- <td colspan="2">
									<select class="channelCabinsClass"  id="cabin_${item.hbaseKey}" name="comparedCabins"  style=" width: 90px;" onclick="changeCabin(this);">
										<option value="">-- 请选择 --</option>
									</select>
								</td> --%>
								
							</tr>
							<tr  class="tab">
								<td align="right" class="left"><s:i18n name="forms"><s:text name="forms.compareClassLevel"></s:text></s:i18n>：</td>
								<td colspan="2">
									<c:forEach var="item" items="${crawlChannels}">
									<select class="channelCabinsClass"  id="cabin_${item.hbaseKey}" name="comparedCabins"  style=" width: 90px;" onclick="changeCabin(this);">
										<option value="">-- <s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n>--</option>
									</select>
									</c:forEach>
								</td>
								<td></td>
							</tr>
						
						<tr>
							<td style="text-align:center;height:35px;" colspan="9">
								<input type="button" onclick="queryValidate()" value="" class="<s:i18n name='forms'><s:text name='forms.btn01'></s:text></s:i18n>" />
								 <input	type="button" onclick="resetForm()" value="" class="<s:i18n name='forms'><s:text name='forms.btn02'></s:text></s:i18n>" />
							</td>
						</tr>
					</table>
				</form>
			</div>
			<br><br>
			
					<div id="chartDiv" align="center"
						style="padding-bottom: 1px; width: 100%; height: 420;"></div>
						<div id= 'spreadContainer' style="overflow:scroll;"></div>
			
		</div>
		<br><br> <br><br> <br><br> <br><br>
										<br><br><br><br> <br> <br> <br>
																	<br> <br> <br><br> 
		<%@ include file="/include/home/home_footer.jsp" %> 															
	</body>
</html>

